﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.Linq;
using System.Data;
using System.Data.Entity;
using System.Data.EntityClient;
using System.Data.EntityModel;
using System.Data.EntityModel.SchemaObjectModel;
using System.Threading;
using System.Web.Services;
using AjaxControlToolkit;
using System.Collections.Specialized;
using OrmAuto;

public partial class Controls_AgenteOffertaControl : System.Web.UI.UserControl
{
		Querier mQuerier = new Querier();
		QueryUtenti mqUtenti = new QueryUtenti();

		protected void Page_Load(object sender, EventArgs e)
		{
				if (!Page.IsPostBack)
						inizializza();
		}//fM

		private void inizializza()
		{
				try
				{
				   //this.ListView1.DefaultMode = FormViewMode.ReadOnly;
							//this.ListView1.DataSource = mQuerier.getAnnVenditaCompleto(4);
				   //this.ListView1.DataBind();
				      
			
						//this.ListBoxMerceologie.DataTextField = "Merceologie_Tipo";
						//this.ListBoxMerceologie.DataValueField = "Merceologie_ID";
						//this.ListBoxMerceologie.DataSource = mQuerier.getMerceologie(null);
						//this.ListBoxMerceologie.DataBind();

						//this.DropDownSconto.DataSource = System.Linq.Enumerable.Range(0, 70);
						//this.DropDownSconto.DataBind();

						//this.DropDownORE.DataSource = System.Linq.Enumerable.Range(0, 24);
						//this.DropDownORE.DataBind();

						//this.myDropStatoLocata.DataTextField = "Stato_Stato";
						//this.myDropStatoLocata.DataValueField = "Stato_ID";
						//this.myDropStatoLocata.DataSource = mqUtenti.getStati();
						//this.myDropStatoLocata.DataBind();

						//this.myDropRegioneLocata.DataTextField = "Reg_Regione";
						//this.myDropRegioneLocata.DataValueField = "Reg_Id";
						//this.myDropRegioneLocata.DataSource = mqUtenti.getRegioni(null);
						//this.myDropRegioneLocata.DataBind();

						//this.myDropProvinciaLocata.DataTextField = "Prov_Provincia";
						//this.myDropProvinciaLocata.DataValueField = "Prov_Id";
						//this.myDropProvinciaLocata.DataSource = mqUtenti.getProvince(null);
						//this.myDropProvinciaLocata.DataBind();

				}
				catch (Exception ex)
				{
						this.myLiteralMsg.Text = "Errore : " + ex.Message;
				}

		}//fM


		public void ListBoxMerceologie_SelectedIndexChanged(object sender, EventArgs e)
		{

		}//fM

		//bottone ok memorizza //////////////////////
		protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
		{
				Page.Validate();
				if (!Page.IsValid) return;

				try
				{
						memoData();
				}
				catch (Exception ex)
				{
						this.myLiteralMsg.Text = "Errori : " + ex.Message;
						//if (ex.InnerException != null) this.LiteralMsg.Text += "<br />" + ex.InnerException.Message;
				}

		}//fM


		private void memoData()
		{
				Security sec = new Security();
				
				//string titolo = myTxtTitolo.Text.Trim();
				//if(string.IsNullOrEmpty(titolo))
				//  throw new ArgumentException("Immettere un titolo");
				//string carNot=string.Empty;		
				//if(sec.CiSonoCarNonAmmessi(titolo,out carNot) )
				//  throw new ArgumentException("Caratteri non ammessi nel titolo : "+ carNot);


				//if (ListBoxMerceologie.SelectedIndex < 0)
				//  throw new ArgumentException("Selezionare una merceologia");

				//if (this.ListBoxCatMerceologie.SelectedIndex < 0)
				//  throw new ArgumentException("Selezionare una merceologia");



						//this.LiteralMsg.Text = "AGENTE SALVATO -> ( " + DateTime.Today.ToLongDateString() + " " + DateTime.Now.ToLongTimeString();
				}


		protected void FormView1_ItemInserting(object sender, FormViewInsertEventArgs e)
		{
				var coll = e.Values;
		}//fM
		
}//fca


